/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sdd.facades.view;

import com.sdd.entities.Feature;
import com.sdd.facades.business.FeatureBusinessFacadeBean;
import com.sdd.facades.factories.FeatureFactoryFacadeBean;
import com.sdd.plains.FeaturePlain;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author T
 */
@Stateless
public class FeatureViewFacadeBean implements FeatureViewFacade {

    @EJB
    FeatureBusinessFacadeBean business;
    @EJB
    FeatureFactoryFacadeBean factory;

    @Override
    public FeaturePlain getFeature(long id) {
        Feature f = business.getFeature(id);
        return factory.createFeaturePlain(f);
    }

    @Override
    public FeaturePlain addFeature(FeaturePlain featurePlain) {
        Feature f = business.addFeature(featurePlain);
        return factory.createFeaturePlain(f);
    }

    @Override
    public List<FeaturePlain> getFeaturesByCategory(Long id) {
        List<Feature> featureFromFeatureCategory = business.getFeatureFromFeatureCategory(id);
        return factory.createFeaturesPlains(featureFromFeatureCategory);
    }
}
